<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>你可以工作的最大周数</title>
</head>
<body>
  <script>
    function fn(nums) {
      let sum = 0, max = 0
      for(let i of nums){
        sum += i
        max = Math.max(i, max)
      }
      if(max*2 <= sum) return sum
      else return (sum - max)*2 + 1
    }
    console.log(fn([1, 2, 3]))
  </script>
</body>
</html>